
#import "GetLoginFormRequest.h"

@implementation GetLoginFormRequest

//
// captcha address
//
@synthesize captchaAddress													= _captchaAddress;

//
// init
//
- (id)init
{
	//
	// call super
	//
	self																	= [super init];
	if(!self)
		return nil;
	
	//
	// create parser
	//
	self.relPath															= @"login.php";
	self.xmlParser															= [[[XmlParser alloc] init] autorelease];
	
	return self;
}

//
// dealloc
//
- (void)dealloc
{
	self.captchaAddress														= nil;
	
	[super dealloc];
}

//
// finished
//
- (void)connectionDidFinishLoading:(NSURLConnection*)connection
{
	if(self.response.statusCode == 200)
	{
		[self.xmlParser parseDocumentData:self.dataBuffer htmlMode:YES];
		self.captchaAddress													= [self.xmlParser stringFromPath:@"//img[@alt='CAPTCHA Image']/@src" startNode:0];
	}
	
	[super connectionDidFinishLoading:connection];
}

@end
